import re

def get_intervals(text: str):
	intervals = []
	for line in text.split("\n"):
		timepoints = re.findall(r"[\d\d:]+\d\d", line)

		if not timepoints:
			continue

		timepoint = timepoints[0]
		title = line.replace(timepoint, "").strip()
		intervals.append((timepoint, title))

	return _convert_intervals(intervals)

def _convert_intervals(intervals):
	intervals_list = []
	for timepoint, title in intervals:
		timepoint = ":".join(
			["0"*(2 - len(time)) + time for time in timepoint.split(":")]
		)
		timepoint = "00:"*(3 - len(timepoint.split(":"))) + timepoint

		intervals_list.append({
			"start": timepoint,
			"title": title
		})

	for i in range(len(intervals_list)):
		if i < len(intervals_list) - 1:
			intervals_list[i]["end"] = intervals_list[i+1]["start"]
		else:
			intervals_list[i]["end"] = "99:59:59"

	return intervals_list
